package org.jground.rx.def.apps.cip;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.accounting.*;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.apps.knowledge.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.crm.*;
import org.jground.rx.def.apps.core.*;
import org.jground.rx.def.apps.legal.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class Product extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.cip.Product";

    private static final String productName ="productName";
    private static final String productDescription ="productDescription";
    private static final String project ="project";
    private static final String designers ="designers";
    private static final String startDate ="startDate";
    private static final String pictures ="pictures";
    private static final String documents ="documents";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String productName ="productName";
        public static final String productDescription ="productDescription";
        public static final String project ="project";
        public static final String designers ="designers";
        public static final String startDate ="startDate";
        public static final String pictures ="pictures";
        public static final String documents ="documents";
        public static final String $CREATOR ="$CREATOR";
    }

    public static Product createNew() { return new Product(RXObjectService.getInstance().create(moid)); }

    public static Product getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new Product(mod);
    }

    public static Product[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        Product[] res = new Product[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new Product(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static Product[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static Product[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        Product[] res = new Product[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new Product(mod);
            i++;
        }
        return res;
    }

    public static Product wrap(IRXObjectSynopsis mod) { 
        return new Product(mod);
    }

    private Product(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getProductNameLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, productName).getLabel();
    }

    public static String getProductNameDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, productName).getDescription();
    }

    public void setProductName(String string) {
        rxObject.set(productName, _to_String(string));
    }

    public String getProductName() {
        return _to_String(rxObject.getCurrentValue(productName));
    }

    public static String getProductDescriptionLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, productDescription).getLabel();
    }

    public static String getProductDescriptionDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, productDescription).getDescription();
    }

    public void setProductDescription(String text) {
        rxObject.set(productDescription, _to_String(text));
    }

    public String getProductDescription() {
        return _to_String(rxObject.getCurrentValue(productDescription));
    }

    public static String getProjectLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, project).getLabel();
    }

    public static String getProjectDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, project).getDescription();
    }

    public void setProject(org.jground.rx.def.apps.cip.Project value) {
        rxObject.set(project, _to_String(value));
    }

    public org.jground.rx.def.apps.cip.Project getProject() {
        return org.jground.rx.def.apps.cip.Project.getById(rxObject.getCurrentValue(project));
    }

    public static String getDesignersLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, designers).getLabel();
    }

    public static String getDesignersDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, designers).getDescription();
    }

    public void addDesigners(org.jground.rx.def.apps.core.Person... value) {
        rxObject.set(designers, _to_String(value));
    }

    public void setDesigners(org.jground.rx.def.apps.core.Person[] values) {
        rxObject.set(designers, _to_String(values));
    }

    public int getDesignersSize() {
        return StringUtils.rnn(rxObject.getValues(designers)).length;
    }

    public org.jground.rx.def.apps.core.Person[] getDesigners() {
        return org.jground.rx.def.apps.core.Person.getByIds(rxObject.getValues(designers));
    }

    public org.jground.rx.def.apps.core.Person getDesigners(int index) {
        return org.jground.rx.def.apps.core.Person.getByIds(rxObject.getValues(designers))[index];
    }

    public static String getStartDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, startDate).getLabel();
    }

    public static String getStartDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, startDate).getDescription();
    }

    public void setStartDate(String dateValue) {
        rxObject.set(startDate, _to_String(dateValue));
    }

    public String getStartDate() {
        return _to_String(rxObject.getCurrentValue(startDate));
    }

    public static String getPicturesLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, pictures).getLabel();
    }

    public static String getPicturesDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, pictures).getDescription();
    }

    public int getPicturesSize() {
        return org.jground.rx.def.apps.commons.Picture.wrap(rxObject.getComponents(AttName.pictures)).length;
    }

    public org.jground.rx.def.apps.commons.Picture[] getPictures() {
        return org.jground.rx.def.apps.commons.Picture.wrap(rxObject.getComponents(AttName.pictures));
    }

    public org.jground.rx.def.apps.commons.Picture getPictures(int index) {
        return org.jground.rx.def.apps.commons.Picture.wrap(rxObject.getComponents(AttName.pictures))[index];
    }

    public org.jground.rx.def.apps.commons.Picture createPictures() {
        return org.jground.rx.def.apps.commons.Picture.wrap(rxObject.newComponent(pictures));
    }

    public void setPictures(org.jground.rx.def.apps.commons.Picture[] values) {
        rxObject.set(pictures, _to_String(pictures));
    }

    public void addPictures(org.jground.rx.def.apps.commons.Picture value) {
        rxObject.add(pictures, value.getOidString());
    }

    public static String getDocumentsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getLabel();
    }

    public static String getDocumentsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getDescription();
    }

    public int getDocumentsSize() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents)).length;
    }

    public org.jground.rx.def.apps.commons.Document[] getDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents));
    }

    public org.jground.rx.def.apps.commons.Document getDocuments(int index) {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents))[index];
    }

    public org.jground.rx.def.apps.commons.Document createDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.newComponent(documents));
    }

    public void setDocuments(org.jground.rx.def.apps.commons.Document[] values) {
        rxObject.set(documents, _to_String(documents));
    }

    public void addDocuments(org.jground.rx.def.apps.commons.Document value) {
        rxObject.add(documents, value.getOidString());
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
